import {UserBo, UserSearchBo, UserVo} from "@/dto/User/User.ts";
import axiosRequest from "@/config/axios.ts";
import Result from "@/common/Result.ts";
import {BasicApi} from "@/common/BasicApi.ts";
import SelectVo from "@/common/SelectVo.ts";
import PageVo from "@/common/PageVo.ts";

class UserApi implements BasicApi<UserVo, UserBo, UserSearchBo>{
    async listAll(sb: UserSearchBo): Promise<Result<Array<UserVo>>> {
        return await axiosRequest.post<UserSearchBo,Result<Array<UserVo>>>("/user/list_all",sb);
    }

    async deleted(sb: UserSearchBo): Promise<Result<UserVo>> {
        return await axiosRequest.post<UserSearchBo,Result<UserVo>>("/user/deleted",sb);
    }

    async deletedAll(sbList: Array<UserSearchBo>): Promise<Result<Array<UserVo>>> {
        return await axiosRequest.post<UserSearchBo,Result<Array<UserVo>>>("/user/deleted_all",sbList);
    }

    async edit(b: UserBo): Promise<Result<UserVo>> {
        return await axiosRequest.post<UserBo,Result<UserVo>>("/user/edit", b);
    }

    async editAll(bList: Array<UserBo>): Promise<Result<Array<UserVo>>>{
        return await axiosRequest.post<UserBo,Result<Array<UserVo>>>("/user/edit_all",bList);
    }

    async get(sb: UserSearchBo): Promise<Result<UserVo>> {
        return await axiosRequest.post<UserSearchBo,Result<UserVo>>("/user/get",sb);
    }

    async option(): Promise<Result<Array<SelectVo<string, number, UserVo>>>> {
        return await axiosRequest.get<Object,Result<Array<SelectVo<string, number, UserVo>>>>("/user/option");
    }

    async pageAll(sb: UserSearchBo): Promise<Result<PageVo<UserVo>>> {
        return await axiosRequest.post<UserSearchBo,Result<PageVo<UserVo>>>("/user/page_all",sb);
    }
}
export default UserApi